<?xml version="1.0"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><head><title>SASAPI</title><script src="../../../quicknav.js" type="text/javascript"></script><script><!--
document.quicknavBasePath="../../../index-files";
//--></script><link href="../../../style.css" title="JavaDoc" rel="stylesheet" type="text/css"/><link href="../../../unnatural.css" title="Unnatural" rel="alternate stylesheet" type="text/css"/><link href="../../../overview-summary.html" title="Overview" rel="top"/><meta name="generator" content="http://www.badgers-in-foil.co.uk/projects/as2api/"/></head><body><pre><span class="lineno" id="1">     1  </span><span class="comment doc">/**
<span class="lineno" id="2">     2  </span> * com.sekati.draw.Curve
<span class="lineno" id="3">     3  </span> * @version 1.0.3
<span class="lineno" id="4">     4  </span> * @author jason m horwitz | sekati.com
<span class="lineno" id="5">     5  </span> * Copyright (C) 2007  jason m horwitz, Sekat LLC. All Rights Reserved.
<span class="lineno" id="6">     6  </span> * Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
<span class="lineno" id="7">     7  </span> */</span>
<span class="lineno" id="8">     8  </span>
<span class="lineno" id="9">     9  </span><span class="key">import</span> com.sekati.geom.Point;
<span class="lineno" id="10">    10  </span>
<span class="lineno" id="11">    11  </span><span class="comment doc">/**
<span class="lineno" id="12">    12  </span> * Tweenable Curve Object
<span class="lineno" id="13">    13  </span> */</span>
<span class="lineno" id="14">    14  </span><span class="key">class</span> com.sekati.draw.Curve {
<span class="lineno" id="15">    15  </span>
<span class="lineno" id="16">    16  </span>	<span class="key">private</span> <span class="key">var</span> _mc:MovieClip;
<span class="lineno" id="17">    17  </span>	<span class="key">public</span> <span class="key">var</span> _p1:Point;
<span class="lineno" id="18">    18  </span>	<span class="key">public</span> <span class="key">var</span> _p2:Point;
<span class="lineno" id="19">    19  </span>	<span class="key">public</span> <span class="key">var</span> _c:Point;
<span class="lineno" id="20">    20  </span>	<span class="key">public</span> <span class="key">var</span> _sw:Number;
<span class="lineno" id="21">    21  </span>	<span class="key">public</span> <span class="key">var</span> _sc:Number;
<span class="lineno" id="22">    22  </span>	<span class="key">public</span> <span class="key">var</span> _sa:Number;
<span class="lineno" id="23">    23  </span>
<span class="lineno" id="24">    24  </span>	<span class="comment doc">/**
<span class="lineno" id="25">    25  </span>	 * Curve Constructor
<span class="lineno" id="26">    26  </span>	 * @param mc (MovieClip)
<span class="lineno" id="27">    27  </span>	 * @param p1 (Point) point 1
<span class="lineno" id="28">    28  </span>	 * @param p2 (Point) point 2
<span class="lineno" id="29">    29  </span>	 * @param c (Point) curve point
<span class="lineno" id="30">    30  </span>	 * @param strokeWeight (Number) line width [default: 1]
<span class="lineno" id="31">    31  </span>	 * @param strokeColor (Number) line color [default: 0x000000]
<span class="lineno" id="32">    32  </span>	 * @param strokeAlpha (Number) line alpha transparency [default: 100]
<span class="lineno" id="33">    33  </span>	 * @return Void
<span class="lineno" id="34">    34  </span>	 */</span>
<span class="lineno" id="35">    35  </span>	<span class="key">public</span> <span class="key">function</span> Curve(mc:MovieClip, p1:Point, p2:Point, c:Point, strokeWeight:Number, strokeColor:Number, strokeAlpha:Number) {
<span class="lineno" id="36">    36  </span>		_mc = mc;
<span class="lineno" id="37">    37  </span>		_sw = (!strokeWeight) ? undefined : strokeWeight;
<span class="lineno" id="38">    38  </span>		_sc = (isNaN( strokeColor )) ? 0x000000 : strokeColor;
<span class="lineno" id="39">    39  </span>		_sa = (isNaN( strokeAlpha )) ? <span class="num_const">100</span> : strokeAlpha;
<span class="lineno" id="40">    40  </span>		_p1 = p1;
<span class="lineno" id="41">    41  </span>		_p2 = p2;
<span class="lineno" id="42">    42  </span>		_c = c;
<span class="lineno" id="43">    43  </span>		draw( );
<span class="lineno" id="44">    44  </span>	}
<span class="lineno" id="45">    45  </span>
<span class="lineno" id="46">    46  </span>	<span class="comment doc">/**
<span class="lineno" id="47">    47  </span>	 * (Re)Draw Curve with current properties.
<span class="lineno" id="48">    48  </span>	 * @return Void
<span class="lineno" id="49">    49  </span>	 */</span>
<span class="lineno" id="50">    50  </span>	<span class="key">public</span> <span class="key">function</span> draw():Void {
<span class="lineno" id="51">    51  </span>		_mc.clear( );
<span class="lineno" id="52">    52  </span>		_mc.lineStyle( _sw, _sc, _sa, <span class="key">true</span>, <span class="str_const">"none"</span>, <span class="str_const">"round"</span>, <span class="str_const">"round"</span>, <span class="num_const">8</span> );
<span class="lineno" id="53">    53  </span>		_mc.moveTo( _p1.x, _p1.y );
<span class="lineno" id="54">    54  </span>		_mc.curveTo( _c.x, _c.y, _p2.x, _p2.y );
<span class="lineno" id="55">    55  </span>	}	
<span class="lineno" id="56">    56  </span>
<span class="lineno" id="57">    57  </span>	<span class="key">public</span> <span class="key">function</span> get p1x():Number {
<span class="lineno" id="58">    58  </span>		<span class="key">return</span> _p1.x;	
<span class="lineno" id="59">    59  </span>	}
<span class="lineno" id="60">    60  </span>
<span class="lineno" id="61">    61  </span>	<span class="key">public</span> <span class="key">function</span> set p1x(n:Number):Void {
<span class="lineno" id="62">    62  </span>		_p1.x = n;
<span class="lineno" id="63">    63  </span>		draw( );
<span class="lineno" id="64">    64  </span>	}	
<span class="lineno" id="65">    65  </span>
<span class="lineno" id="66">    66  </span>	<span class="key">public</span> <span class="key">function</span> get p1y():Number {
<span class="lineno" id="67">    67  </span>		<span class="key">return</span> _p1.y;	
<span class="lineno" id="68">    68  </span>	}
<span class="lineno" id="69">    69  </span>
<span class="lineno" id="70">    70  </span>	<span class="key">public</span> <span class="key">function</span> set p1y(n:Number):Void {
<span class="lineno" id="71">    71  </span>		_p1.y = n;	
<span class="lineno" id="72">    72  </span>		draw( );
<span class="lineno" id="73">    73  </span>	}	
<span class="lineno" id="74">    74  </span>
<span class="lineno" id="75">    75  </span>	<span class="key">public</span> <span class="key">function</span> get p2x():Number {
<span class="lineno" id="76">    76  </span>		<span class="key">return</span> _p2.x;	
<span class="lineno" id="77">    77  </span>	}
<span class="lineno" id="78">    78  </span>
<span class="lineno" id="79">    79  </span>	<span class="key">public</span> <span class="key">function</span> set p2x(n:Number):Void {
<span class="lineno" id="80">    80  </span>		_p2.x = n;	
<span class="lineno" id="81">    81  </span>		draw( );
<span class="lineno" id="82">    82  </span>	}	
<span class="lineno" id="83">    83  </span>
<span class="lineno" id="84">    84  </span>	<span class="key">public</span> <span class="key">function</span> get p2y():Number {
<span class="lineno" id="85">    85  </span>		<span class="key">return</span> _p2.y;	
<span class="lineno" id="86">    86  </span>	}
<span class="lineno" id="87">    87  </span>
<span class="lineno" id="88">    88  </span>	<span class="key">public</span> <span class="key">function</span> set p2y(n:Number):Void {
<span class="lineno" id="89">    89  </span>		_p2.y = n;	
<span class="lineno" id="90">    90  </span>		draw( );
<span class="lineno" id="91">    91  </span>	}
<span class="lineno" id="92">    92  </span>
<span class="lineno" id="93">    93  </span>	<span class="key">public</span> <span class="key">function</span> get cx():Number {
<span class="lineno" id="94">    94  </span>		<span class="key">return</span> _c.x;	
<span class="lineno" id="95">    95  </span>	}
<span class="lineno" id="96">    96  </span>
<span class="lineno" id="97">    97  </span>	<span class="key">public</span> <span class="key">function</span> set cx(n:Number):Void {
<span class="lineno" id="98">    98  </span>		_c.x = n;	
<span class="lineno" id="99">    99  </span>		draw( );
<span class="lineno" id="100">   100  </span>	}
<span class="lineno" id="101">   101  </span>
<span class="lineno" id="102">   102  </span>	<span class="key">public</span> <span class="key">function</span> get cy():Number {
<span class="lineno" id="103">   103  </span>		<span class="key">return</span> _c.y;	
<span class="lineno" id="104">   104  </span>	}
<span class="lineno" id="105">   105  </span>
<span class="lineno" id="106">   106  </span>	<span class="key">public</span> <span class="key">function</span> set cy(n:Number):Void {
<span class="lineno" id="107">   107  </span>		_c.y = n;	
<span class="lineno" id="108">   108  </span>		draw( );
<span class="lineno" id="109">   109  </span>	}	
<span class="lineno" id="110">   110  </span>}</pre><ul class="main_nav" id="main_nav"><li><a href="../../../overview-summary.html" title="Overview of SASAPI" class="button">Overview</a></li><li><a href="package-summary.html" title="Overview of package com.sekati.draw" class="button">Package</a></li><li><a href="Curve.html" title="Detail of com.sekati.draw.Curve API" class="button">Class</a></li><li><span class="button nav_current">Source</span></li><li><a href="../../../index-files/index.html" title="Alpabetical index of types and members" class="button">Index</a></li></ul><div class="footer"><a href="http://www.badgers-in-foil.co.uk/projects/as2api/" title="ActionScript 2 API Documentation Generator">as2api</a></div></body></html>